package com.render;

import static org.lwjgl.opengl.GL11.glTranslatef;

import java.awt.Rectangle;

import org.lwjgl.opengl.GL11;

import base.living.Entity;
import base.render.RenderEntity;

import com.living.Block;

public class RenderBlock extends RenderEntity
{
	@Override
	public void onRender(Entity par1Entity)
	{
		Block block = (Block) par1Entity;
		Rectangle boundingbox = block.getBoundingBox();

		GL11.glPushMatrix();
		{
			glTranslatef(boundingbox.x + 8, boundingbox.y + 8, 0);
			drawWithRotation(par1Entity.getPosRot());
			glTranslatef(-boundingbox.x - 8, -boundingbox.y - 8, 0);

			drawWithColor(0x111111);
			drawBox(boundingbox.x, boundingbox.y, 16, 16);
		}
		GL11.glPopMatrix();

		GL11.glPushMatrix();
		{
			glTranslatef(boundingbox.x + 8, boundingbox.y + 8, 0);
			drawWithRotation(par1Entity.getPosRot());
			glTranslatef(-boundingbox.x - 8, -boundingbox.y - 8, 0);

			drawWithColor(block.getBlockColor());
			drawBox(boundingbox.x + 1, boundingbox.y + 1, 14, 14);
		}
		GL11.glPopMatrix();
	}
}
